
//          CH   1    2    3    4
// TIM1         PA8  PA9  PA10  PA11 
// TIM2         PA0  PA1  PA2   PA3 
// TIM3         PA6  PA7  PB0   PB1 
// TIM4         PB6  PB7  PB8   PB9
// TIM5         PA0  PA1  PA2   PA3

#ifndef PWM_H
#define PWM_H

#include <stdint.h>

typedef enum {
	PWM_TIM1_CH1,
	PWM_TIM1_CH2,
	PWM_TIM1_CH3,
	PWM_TIM1_CH4,
	PWM_TIM2_CH1,
	PWM_TIM2_CH2,
	PWM_TIM2_CH3,
	PWM_TIM2_CH4,
	PWM_TIM3_CH1,
	PWM_TIM3_CH2,
	PWM_TIM3_CH3,
	PWM_TIM3_CH4,
	PWM_TIM4_CH1,
	PWM_TIM4_CH2,
	PWM_TIM4_CH3,
	PWM_TIM4_CH4,
	PWM_TIM5_CH1,
	PWM_TIM5_CH2,
	PWM_TIM5_CH3,
	PWM_TIM5_CH4,
} PWM_TIM_CHN_E;

typedef enum {
	PWM_TIM1,
	PWM_TIM2,
	PWM_TIM3,
	PWM_TIM4,
	PWM_TIM5,
	PWM_TIM1_PARTIAL,
	PWM_TIM2_PARTIAL1,
	PWM_TIM2_PARTIAL2,
	PWM_TIM3_PARTIAL,
    PWM_TIM1_FULL,
	PWM_TIM2_FULL,
	PWM_TIM3_FULL,
	PWM_TIM4_FULL,
} PWM_TIM_E;

typedef enum {
	PWM_CH1,
	PWM_CH2,
	PWM_CH3,
	PWM_CH4,
} PWM_CHN_E;


void PwmInit(PWM_TIM_CHN_E tim_chn, uint32_t freq, uint16_t period);
void PwmInit(PWM_TIM_E tim, PWM_CHN_E chn, uint32_t freq, uint16_t period);
void PwmSetPulse(PWM_TIM_CHN_E tim_chn, uint16_t pulse);
void PwmSetPulse(PWM_TIM_E tim, PWM_CHN_E chn, uint16_t pulse);

#endif
